home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / ELF / elf_xlate3E.txt < prev    next >
Encoding:
Text File  |  1996-11-11  |  4.5 KB  |  102 lines

  1.  
  2. elf_xlate(3E)                  Silicon Graphics                  elf_xlate(3E)
  3.  
  4. NAME
  5.      elf_xlate: elf32_xlatetof, elf32_xlatetom,elf64_xlatetof, elf64_xlatetom
  6.      - class-dependent data translation
  7.  
  8. SYNOPSIS
  9.      cc [flag ...] file ...  -lelf [library ...]
  10.  
  11.      #include <libelf.h>
  12.  
  13.      Elf_Data *elf32_xlatetof(Elf_Data *dst, const Elf_Data *src,
  14.           unsigned encode);
  15.      Elf_Data *elf32_xlatetom(Elf_Data *dst, const Elf_Data *src,
  16.           unsigned encode);
  17.  
  18.      Elf_Data *elf64_xlatetof(Elf_Data *dst, const Elf_Data *src,
  19.           unsigned encode);
  20.      Elf_Data *elf64_xlatetom(Elf_Data *dst, const Elf_Data *src,
  21.           unsigned encode);
  22.  
  23. DESCRIPTION
  24.      elf32_xlatetom translates various data structures from their 32-bit class
  25.      file representations to their memory representations; elf32_xlatetof
  26.      provides the inverse.  This conversion is particularly important for
  27.      cross development environments.  src is a pointer to the source buffer
  28.      that holds the original data; dst is a pointer to a destination buffer
  29.      that will hold the translated copy.  encode gives the byte encoding in
  30.      which the file objects are (to be) represented and must have one of the
  31.      encoding values defined for the ELF header's e_ident[EI_DATA] entry [see
  32.      elf_getident(3E)].  If the data can be translated, the functions return
  33.      dst.  Otherwise, they return null because an error occurred, such as
  34.      incompatible types, destination buffer overflow, etc.
  35.  
  36.      elf_getdata(3E) describes the Elf_Data descriptor, which the translation
  37.      routines use as follows.
  38.  
  39.      d_buf         Both the source and destination must have valid buffer
  40.                    pointers.
  41.  
  42.      d_type        This member's value specifies the type of the data to which
  43.                    d_buf points and the type of data to be created in the
  44.                    destination.  The program supplies a d_type value in the
  45.                    source; the library sets the destination's d_type to the
  46.                    same value.  These values are summarized below.
  47.  
  48.      d_size        This member holds the total size, in bytes, of the memory
  49.                    occupied by the source data and the size allocated for the
  50.                    destination data.  If the destination buffer is not large
  51.                    enough, the routines do not change its original contents.
  52.                    The translation routines reset the destination's d_size
  53.                    member to the actual size required, after the translation
  54.                    occurs.  The source and destination sizes may differ.
  55.  
  56. Page 1                           Release 6.2
  57.  
  58. elf_xlate(3E)                  Silicon Graphics                  elf_xlate(3E)
  59.  
  60.      d_version     This member holds version number of the objects (desired)
  61.                    in the buffer.  The source and destination versions are
  62.                    independent.
  63.  
  64.      Translation routines allow the source and destination buffers to
  65.      coincide.  That is, dst->d_buf may equal src->d_buf.  Other cases where
  66.      the source and destination buffers overlap give undefined behavior.
  67.  
  68.                           Elf_Type     32-Bit Memory Type
  69.  
  70.                          ____________|___________________
  71.                          ELF_T_ADDR  | Elf32_Addr
  72.                          ELF_T_BYTE  | unsigned char
  73.                          ELF_T_DYN   | Elf32_Dyn
  74.                          ELF_T_EHDR  | Elf32_Ehdr
  75.                          ELF_T_HALF  | Elf32_Half
  76.                          ELT_T_OFF   | Elf32_Off
  77.                          ELF_T_PHDR  | Elf32_Phdr
  78.                          ELF_T_REL   | Elf32_Rel
  79.                          ELF_T_RELA  | Elf32_Rela
  80.                          ELF_T_SHDR  | Elf32_Shdr
  81.                          ELF_T_SWORD | Elf32_Sword
  82.                          ELF_T_SYM   | Elf32_Sym
  83.                          ELF_T_WORD  | Elf32_Word
  84.                          ____________|___________________
  85.  
  86.      ``Translating'' buffers of type ELF_T_BYTE does not change the byte
  87.      order.
  88.  
  89.      The 64-bit class works identically, simply replacing all instances of 32
  90.      in the description and table with 64.
  91.  
  92. SEE ALSO
  93.      elf(3E), elf_fsize(3E), elf_getdata(3E), elf_getident(3E).
  94.  
  95. CAVEAT
  96.      By default, the Elf_Data used for the 64-bit class in a 32-bit
  97.      application restricts one to building 64-bit class applications with only
  98.      32-bit fields unless the entire application is compliled with
  99.      _LIBELF_XTND_64 defined (see elf.3e).
  100.  
  101. Page 2                           Release 6.2
  102.